<?php
echo $callbackFunction . '({';
echo '"totalCount":"' . $count . '",';
echo '"tours":[';
$counter = 0;
if (count($data) > 0) {
	foreach ($data as $tour) {
		$counter++;
		echo '{';
		echo '"id":"' . $tour->id . '",';
		echo '"title":"' . addcslashes(htmlspecialchars($tour->title, ENT_QUOTES), '\\') . '",';
		echo '"price":"' . $tour->price . '",';
		echo '"actions":"<a href=\"javascript: editTour(' . $tour->id  . ');\">изменить</a>&nbsp;<a href=\"javascript: deleteTour(' . $tour->id . ');\">удалить</a>"';
		echo '}';
		if ($counter != count($data)) echo ',';
	}
}
echo ']});'; ?>